Skip to content

Add --ca-cert flag for HTTPS interception proxy support#1026

Open
ctate wants to merge 5 commits intomainfrom
fix/issue-1022-1774463689932
Open

Add --ca-cert flag for HTTPS interception proxy support#1026
ctate wants to merge 5 commits intomainfrom
fix/issue-1022-1774463689932

Conversation

@ctate
Copy link
Copy Markdown
Collaborator

@ctate ctate commented Mar 25, 2026

Adds support for trusting specific CA certificates when using HTTPS-intercepting proxies (corporate egress proxies, security appliances like Zscaler/Netskope, development tools like mitmproxy).

Problem

agent-browser fails with ERR_CERT_AUTHORITY_INVALID behind HTTPS-intercepting proxies that use custom CAs. The current --ignore-https-errors workaround disables ALL certificate validation, creating security risks.

Changes

  • Added --ca-cert <path> CLI flag and AGENT_BROWSER_CA_CERT environment variable
  • Added caCert field to JSON configuration
  • Implemented CA certificate validation via Chromium's --ignore-certificate-errors-spki-list flag
  • Added early validation to check CA certificate file exists
  • Added comprehensive test coverage for flag parsing and configuration merging
  • Updated documentation in README and configuration pages

Implementation Details

  • Computes SHA-256 hash of the CA certificate's Subject Public Key Info (SPKI)
  • Passes the hash to Chromium via launch args for targeted certificate trust
  • Validates certificate file exists before daemon spawn to provide early feedback
  • Maintains security by only trusting the specified CA, not disabling all validation

Fixes #1022

Adds support for trusting specific CA certificates when using HTTPS-intercepting proxies (corporate egress proxies, security appliances like Zscaler/Netskope, development tools like mitmproxy).

## Problem
agent-browser fails with `ERR_CERT_AUTHORITY_INVALID` behind HTTPS-intercepting proxies that use custom CAs. The current `--ignore-https-errors` workaround disables ALL certificate validation, creating security risks.

## Changes
- Added `--ca-cert <path>` CLI flag and `AGENT_BROWSER_CA_CERT` environment variable
- Added `caCert` field to JSON configuration
- Implemented CA certificate validation via Chromium's `--ignore-certificate-errors-spki-list` flag
- Added early validation to check CA certificate file exists
- Added comprehensive test coverage for flag parsing and configuration merging
- Updated documentation in README and configuration pages

## Implementation Details
- Computes SHA-256 hash of the CA certificate's Subject Public Key Info (SPKI)
- Passes the hash to Chromium via launch args for targeted certificate trust
- Validates certificate file exists before daemon spawn to provide early feedback
- Maintains security by only trusting the specified CA, not disabling all validation

Fixes #1022
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser Ready Ready Preview, Comment Apr 7, 2026 7:12am
agent-browser-env-demo Ready Ready Preview, Comment Apr 7, 2026 7:12am

@bilby91
Copy link
Copy Markdown

bilby91 commented Mar 26, 2026

@ctate Thanks for getting this one done :)

My original implementation didn't include the x509 dependency but I though I could be missing edge cases.

On a different topic, any thoughts on #997 ?

@bilby91
Copy link
Copy Markdown

bilby91 commented Apr 7, 2026

@ctate Any plan on landing this anytime soon ?

…3689932

# Conflicts:
#	cli/src/flags.rs
#	cli/src/native/actions.rs
#	cli/src/native/browser.rs
#	cli/src/native/cdp/chrome.rs
#	cli/src/output.rs
…st)]

- Revert unrelated removal of "Console log cleared" match arm in output.rs
- Add #[cfg(test)] to decode_pem_certificate since it's only used in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to trust a specific CA certificate for HTTPS interception proxies

2 participants